<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<jsp:include page="/common.jsp"></jsp:include>
</head>
<body>
	${title }
	<form id="form" class="form-inline well" action="mrp?save" method="post">
		<input name="id" type="hidden" value="${t.id }">
		<label class="text">
			计划单号:
			<input class="input-medium" type="text" name="code" value="${t.code }">
		</label>
		<label class="text">
			生产部门:
			<input class="input-medium" type="text" name="department" value="${t.department }">
		</label>
		<label class="text">
			生产人员:
			<input class="input-medium" type="text" name="personel" value="${t.personel }">
		</label>
		<input type="hidden" name="bom.id" value="${t.bom.id }">
		<label class="text">
			产品代码:
			<input class="input-medium" type="text" name="materiel.code" value="${t.bom.materiel.code }">
			<a class="icon-search" onclick="search_d('produce/bom?query','bom.id,materiel.code,materiel.name,materiel.unit',1)"></a>
		</label>
		<label class="text">
			产品名称:
			<input class="input-medium" type="text" name="materiel.name" value="${t.bom.materiel.name }">
		</label>
		<label class="text">
			产品单位:
			<input class="input-medium" type="text" name="materiel.unit" value="${t.bom.materiel.unit }">
		</label>
		<label class="text">
			计划数量:
			<input class="input-medium" type="text" name="plan_amount" value="${t.plan_amount }">
		</label>
		<label class="text">
			实际数量:
			<input class="input-medium" type="text" name="actual_amount" value="${t.actual_amount }">
		</label>
		<label class="text">
			开始时间:
			<input class="input-medium" type="text" name="startDate" class="Wdate" onfocus="WdatePicker()" value="<fmt:formatDate value="${t.startDate }" pattern="yyyy-MM-dd"/>">
		</label>
		<label class="text">
			结束时间:
			<input class="input-medium" type="text" name="endDate" class="Wdate" onfocus="WdatePicker()" value="<fmt:formatDate value="${t.endDate }" pattern="yyyy-MM-dd"/>">  
		</label>
		<label class="text">
			生产备注:
			<input class="input-medium" type="text" name="remark" value="${t.remark }">
		</label>


		<!-- 当mrp_id为空时不显示 -->
		<!-- mrp_sub of mrp-->
		<c:if test="${t.id!=null}">
			<table
				class="table table-striped table-bordered table-condensed  table-hover">
				<thead>
					<tr>
						<th>序号</th>
						<th>产品编号</th>
						<th>产品名称</th>
						<th>产品单位</th>
						<th>数量</th>
						<th>损耗</th>
						<th>制程代码</th>
						<th>备注</th>
					</tr>
				</thead>
				<tbody>
					<c:set var="num" value="0"></c:set>
					<c:forEach var="mrp_sub" items="${mrp_subs }">
						<input type="hidden" name="mrp_sub_materielId" value="${mrp_sub.materiel.id }">
						<input type="hidden" name="mrp_sub_id" value="${mrp_sub.id }">
						<tr>
							<c:set var="num" value="${num+1 }"></c:set>
							<td>${num }</td>
							<td>${mrp_sub.materiel.code }</td>
							<td>${mrp_sub.materiel.name }</td>
							<td>${mrp_sub.materiel.unit }</td>
							<td><input type="text" name="mrp_sub_amount" class="input-small"
								value="${mrp_sub.amount }"></td>
							<td><input type="text" name="mrp_sub_loss" class="input-small"
								value="${mrp_sub.loss }"></td>
							<td><input type="text" name="mrp_sub_code" class="input-small"
								value="${mrp_sub.code }"></td>
							<td><input type="text" name="mrp_sub_remark" class="input-small"
								value="${mrp_sub.remark }"></td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</c:if>
		
		<div class="control-group">
                <div class="controls">
                    <c:if test="${status==view}">
                        <button class="btn btn-primary" type="submit">保存</button>
                    </c:if>
                    <a class="btn btn-primary" onclick="go('produce/mrp?list')">返回</a>
                </div>
         </div>
	</form>
	<jsp:include page="/foot.jsp"></jsp:include>
</body>
</body>
</html>